<?php 
include "includes/session.php";
include "includes/comunes.php";
$items=ITEMS;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema de Registro de Atencion</title>

<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->
<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<!--estilo para el scroll-->
<style>
  .ui-autocomplete {
    max-height: 300px;
    overflow-y: auto;
    /* prevent horizontal scrollbar */
    overflow-x: hidden;
  }
  /* IE 6 doesn't support max-height
   * we use height instead, but this forces the menu to always be this tall
   */
  * html .ui-autocomplete {
    height: 300px;
  }
  </style>
<!--
  fin estilo scroll-->


<script language="JavaScript" type="text/javascript">
$(function()
{

//        funcion que implementa combos
	$('#tipopedido').chainSelect('#estado','combobox.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
	
	$('#sucursal').chainSelect('#respoId','comboPersonal.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
//        fin funcion

//          funcion que implementa autocompletado de articulos
     
 $( "#fechapla" ).datepicker({
         dateFormat: "yy-mm-dd"

      });

		$( "#respo" ).autocomplete({
			source: "autoResponsables.php",
			minLength: 1,
                select: function(event, ui) {
                    $("#respoId").val(ui.item.id);
					$("#respo").val(ui.item.value);
                }
		});
              










//              funcion para validacion de formularios

             $("#pedido").submit(function () {

                
            
        });

//              fin funcion
      
$( "#menu" ).menu({position: {at: "left bottom"}});
});
</script>

</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal"><img src="img/combustible.png" width="25" height="25" border="0"/> Registrar Carga de combustible
          <?php include 'includes/submenu.php';?>  
           </div>
       <form id="pedido" name="pedido" method="POST" action="grabarCombustible.php">
       <div class="contenedorpedido">
        <fieldset>
             <legend><b>Datos de Cabecera</b></legend>
             <table>
                 <tr>
				 <td class="textotablamenuform" >Sucursal</td>
                     <td class="textotablamenuform" colspan="4">
                        <select name="sucursal" id="sucursal" class="campo_form" required>
                             
                             <?php
							 
							  $ped=obtener_sucursales();
                             while($regPed=mysql_fetch_array($ped)){
                                       echo "<option value='".utf8_encode($regPed['sucursalId'])."'>".utf8_encode($regPed['sucursalNombre'])." (".utf8_encode($regPed['sucursalCodigo']).")</option>";
                           

                             }
							
                             ?>

                         </select>
                     </td>
					
                 <tr>
                      <td class="textotablamenuform">Vehiculo</td>
                         <td class="textotablamenuform" colspan="4">
                        <select name="vehiculo" id="vehiculo" required class="campo_form">
                             
                             <?php
							 
							 
                            
							         $ped=obtener_vehiculos();
                             while($regVeh=mysql_fetch_array($ped)){
                                       echo "<option value='".utf8_encode($regVeh['VehiculoId'])."'>".utf8_encode($regVeh['VehiculoDescripcion'])." (".utf8_encode($regVeh['VehiculoDominio']).")</option>";
                           

                             }
							 

                             ?>

                         </select>
                     </td>
                     <td class="textotablamenuform">Usuario</td>
                     <td class="textotablamenuform"><input type="text" name="usuario" value="<?php echo $_SESSION['usuUsuario']?> " disabled class="campo_form"/></td>
               
                  </tr>
			
                 <tr>
				  <td class="textotablamenuform" colspan="7">
				  <hr>
				  <td>
                     
                 </tr>
			
                 <tr>
                   <td class="textotablamenuform" colspan="1">Combustible</td>
                     <td class="textotablamenuform" colspan="4">
					    <select name="combustible" id="combustible" required class="campo_form">
                             
                             <?php
							 
							 
                            
							         $ped=obtener_combustibles();
                             while($regVeh=mysql_fetch_array($ped)){
                                       echo "<option value='".utf8_encode($regVeh['CombustibleId'])."'>".utf8_encode($regVeh['CombustibleNombre'])."</option>";
                           

                             }
							 

                             ?>

                         </select>
					 </td>
					 <td class="textotablamenuform">Fecha </td>
                     <td class="textotablamenuform"><input type="text" name="fecha" id="fechapla" class="campo_form" required/></td>
              </tr>
			   <tr>
                    <td class="textotablamenuform">Tipo</td>
                    <td class="textotablamenuform" colspan="2">
					 <select name="tipocarga" id="tipocarga" class="campo_form">
                           <!--<option value="1" selected>Interna</option>-->
                           <option value="2" selected>Externa</option>
                         </select>
					
					</td>
					 <td class="textotablamenuform">Proveedor</td>
                     <td class="textotablamenuform" colspan="5">
                           <select name="proveedor" id="proveedor" class="campo_form">
                            <option selected value="0">Todos...</option>
                             <?php
                             $ped=obtener_prov_vehiculos();
                             while($regPed=mysql_fetch_array($ped)){
                                      echo "<option value='".utf8_encode($regPed['ProveedorId'])."'>".utf8_encode($regPed['ProveedorNombre'])."</option>";
									  }

                             ?>

                         </select>
						 
						 </td>
                 </tr>
				  <tr>
                     <td class="textotablamenuform">Comprobante</td>
                     <td class="textotablamenuform">
                         <input type="text" name="comp" id="comp" value="" class="campo_form" />
                     </td>
					 
					    <td class="textotablamenuform">Importe</td>
                     <td class="textotablamenuform">
                         <input type="number" name="costo" id="costo" step="0.1" required value="" class="campo_form" /> </td>
						 <td class="textotablamenuform">Iva</td>
                     <td class="textotablamenuform">
                         <input type="number" name="iva" id="iva" step="0.1" required value="" class="campo_form" /> </td>
                 </tr>
				 <tr>
                     <td class="textotablamenuform">Litros</td>
                     <td class="textotablamenuform">
                         <input type="number" name="litros" step="0.1" id="litros" value="" class="campo_form" />
                     </td>
					  <td class="textotablamenuform">Km/Horas</td>
                     <td class="textotablamenuform">
                        <input type="number" name="km" id="km" value="" required class="campo_form" /> </td>
                  
                      </tr>
				   <tr>
				  <td class="textotablamenuform" colspan="7">
				  <hr>
				  <td>
                     
                 </tr>
                 <tr>
                    <td class="textotablamenuform">Observacion</td>
                    <td class="textotablamenuform" colspan="9"><textarea rows="3" cols="71" class="campo_form" id="observacion" name="observacion"></textarea></td>
                 </tr>
				 <tr>
                
              </tr>
			  <tr>
			   <td class="textotablamenuform" style="text-align: right;" colspan="9">
                         <input type="reset" name="enviar" value="Restablecer"  class="boton_form"/>
                         <input name="submit" id="submit" type="submit" value="Registrar Carga" class="boton_form"/>
                     </td>
					 </tr>
             </table>
        </fieldset>
          
           
       </div>
   </form>
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>
</body>
</html>
